home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 March / maximum-cd-2000-03.iso / Quake3 Game Source / Q3AGameSource.exe / Main / be_ai_chat.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-18  |  3.6 KB  |  97 lines

  1. // Copyright (C) 1999-2000 Id Software, Inc.
  2. //
  3. /*****************************************************************************
  4.  * name:        be_ai_chat.h
  5.  *
  6.  * desc:        char AI
  7.  *
  8.  * $Archive: /source/code/botlib/be_ai_chat.h $
  9.  * $Author: Mrelusive $ 
  10.  * $Revision: 2 $
  11.  * $Modtime: 10/05/99 3:32p $
  12.  * $Date: 10/05/99 3:42p $
  13.  *
  14.  *****************************************************************************/
  15.  
  16. #define MAX_MESSAGE_SIZE        256
  17. #define MAX_CHATTYPE_NAME        32
  18. #define MAX_MATCHVARIABLES        8
  19.  
  20. #define CHAT_GENDERLESS            0
  21. #define CHAT_GENDERFEMALE        1
  22. #define CHAT_GENDERMALE            2
  23.  
  24. #define CHAT_ALL                    0
  25. #define CHAT_TEAM                    1
  26.  
  27. //a console message
  28. typedef struct bot_consolemessage_s
  29. {
  30.     int handle;
  31.     float time;                                    //message time
  32.     int type;                                    //message type
  33.     char message[MAX_MESSAGE_SIZE];                //message
  34.     struct bot_consolemessage_s *prev, *next;    //prev and next in list
  35. } bot_consolemessage_t;
  36.  
  37. //match variable
  38. typedef struct bot_matchvariable_s
  39. {
  40.     char offset;
  41.     int length;
  42. } bot_matchvariable_t;
  43. //returned to AI when a match is found
  44. typedef struct bot_match_s
  45. {
  46.     char string[MAX_MESSAGE_SIZE];
  47.     int type;
  48.     int subtype;
  49.     bot_matchvariable_t variables[MAX_MATCHVARIABLES];
  50. } bot_match_t;
  51.  
  52. //setup the chat AI
  53. int BotSetupChatAI(void);
  54. //shutdown the chat AI
  55. void BotShutdownChatAI(void);
  56. //returns the handle to a newly allocated chat state
  57. int BotAllocChatState(void);
  58. //frees the chatstate
  59. void BotFreeChatState(int handle);
  60. //adds a console message to the chat state
  61. void BotQueueConsoleMessage(int chatstate, int type, char *message);
  62. //removes the console message from the chat state
  63. void BotRemoveConsoleMessage(int chatstate, int handle);
  64. //returns the next console message from the state
  65. int BotNextConsoleMessage(int chatstate, bot_consolemessage_t *cm);
  66. //returns the number of console messages currently stored in the state
  67. int BotNumConsoleMessages(int chatstate);
  68. //enters a chat message of the given type
  69. void BotInitialChat(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7);
  70. //returns the number of initial chat messages of the given type
  71. int BotNumInitialChats(int chatstate, char *type);
  72. //find a reply for the given message
  73. int BotReplyChat(int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7);
  74. //returns the length of the currently selected chat message
  75. int BotChatLength(int chatstate);
  76. //enters the selected chat message
  77. void BotEnterChat(int chatstate, int client, int sendto);
  78. //get the chat message ready to be output
  79. void BotGetChatMessage(int chatstate, char *buf, int size);
  80. //checks if the first string contains the second one, returns index into first string or -1 if not found
  81. int StringContains(char *str1, char *str2, int casesensitive);
  82. //finds a match for the given string
  83. int BotFindMatch(char *str, bot_match_t *match, unsigned long int context);
  84. //returns a variable from a match
  85. void BotMatchVariable(bot_match_t *match, int variable, char *buf, int size);
  86. //unify all the white spaces in the string
  87. void UnifyWhiteSpaces(char *string);
  88. //replace all the context related synonyms in the string
  89. void BotReplaceSynonyms(char *string, unsigned long int context);
  90. //loads a chat file for the chat state
  91. int BotLoadChatFile(int chatstate, char *chatfile, char *chatname);
  92. //store the gender of the bot in the chat state
  93. void BotSetChatGender(int chatstate, int gender);
  94. //store the bot name in the chat state
  95. void BotSetChatName(int chatstate, char *name);
  96.  
  97.